﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Web.Mvc
{
    public class SimpleModelBinder<T> : System.Web.Mvc.IModelBinder
    {
        Func<ControllerContext, ModelBindingContext, T> binder;
        public SimpleModelBinder(Func<ControllerContext, ModelBindingContext, T> binder)
        {
            if (binder == null)
            {
                throw new ArgumentNullException("binder");
            }
            this.binder = binder;
        }

        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            return binder(controllerContext, bindingContext);
        }
    }
}
